home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / keyservh / examples.ctl < prev    next >
Text File  |  1999-08-19  |  2KB  |  71 lines

  1. VERSION 5.00
  2. Begin VB.UserControl ExampleService 
  3.    ClientHeight    =   1935
  4.    ClientLeft      =   0
  5.    ClientTop       =   0
  6.    ClientWidth     =   2475
  7.    ScaleHeight     =   1935
  8.    ScaleWidth      =   2475
  9.    Begin VB.Timer BeepTimer 
  10.       Enabled         =   0   'False
  11.       Interval        =   5000
  12.       Left            =   240
  13.       Top             =   480
  14.    End
  15. End
  16. Attribute VB_Name = "ExampleService"
  17. Attribute VB_GlobalNameSpace = False
  18. Attribute VB_Creatable = True
  19. Attribute VB_PredeclaredId = False
  20. Attribute VB_Exposed = True
  21. '****************************************************************************************************
  22. '   Copyright (c) Key Technology Pty Ltd 1999, All Rights Reserved.
  23. '   Web site: http://www.keytech.com.au  Email: info@keytech.com.au
  24. '****************************************************************************************************
  25.  
  26. Option Explicit
  27.  
  28. '
  29. ' This is an example service that beeps periodically.
  30. '
  31.  
  32. ' Must implement IService to be hosted as a service
  33. Implements IService
  34.  
  35. Private Sub BeepTimer_Timer()
  36.     Beep
  37.     
  38.     ' Message boxes may be displayed if the service is configured
  39.     ' to interact with the desktop. Displaying message boxes is not
  40.     ' recommended as it blocks the service.
  41.     MsgBox "The service is blocked until this message box is dismissed.", _
  42.            vbSystemModal, "Example Service"
  43. End Sub
  44.  
  45. Private Property Get IService_Pausable() As Boolean
  46.     IService_Pausable = True
  47. End Property
  48.  
  49. Private Sub IService_OnStart()
  50.     BeepTimer.Enabled = True
  51. End Sub
  52.  
  53. Private Sub IService_OnStop()
  54.     BeepTimer.Enabled = False
  55. End Sub
  56.  
  57. Private Sub IService_OnPause()
  58.     BeepTimer.Enabled = False
  59. End Sub
  60.  
  61. Private Sub IService_OnContinue()
  62.     BeepTimer.Enabled = True
  63. End Sub
  64.  
  65. Private Sub IService_OnControl(ByVal OpCode As Long)
  66. End Sub
  67.  
  68. Private Sub IService_OnShutdown()
  69.     BeepTimer.Enabled = False
  70. End Sub
  71.